package com.lkm.asking.controller;


import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/json")
public class Test {
    @RequestMapping("/user")
    public String testlog(){
        return "success";
    }


    @RequestMapping("/surereg")
    public void testreg() throws EmailException {
        try{
            HtmlEmail email = new HtmlEmail();//创建一个实例对象
            email.setHostName("smtp.qq.com");//邮箱STMP服务器
            email.setCharset("utf-8");//设置发送的字符类型
            email.addTo("2644819828@qq.com");//设置收送人的邮箱和用户名
            email.setFrom("2644819828@qq.com","asking");
            email.setAuthentication("2644819828@qq.com","zfmwtlrwykijebfh");//发送人邮箱和授权码
            email.setSubject("测试");//发送主题
            email.setMsg("今天是下大暴雨的一天！");
            email.send();//发送

        }catch (Exception e){
            ;
            }
        }
}
